#!/bin/bash
#
read -p "用户：" user
read -p "密码：" passwd
mysqlIO=$(mysql -u$user -p$passwd -e "show slave status\G" 2> /dev/null |grep "Slave_IO_Running: "|awk '{print $2}')
mysqlSQL=$(mysql -u$user -p$passwd -e "show slave status\G" 2> /dev/null  |grep "Slave_SQL_Running: ")

if [ $mysqlIO == Yes ]; then 
  echo "1"
else 
  echo "0"
fi
